package com.hjl.spring6.bean.iocXml.life;

/**
 * @author ServivE
 * @version 0.1
 * @className User
 * @description
 * @date 2024/8/6 16:45
 * @since jdk11
 */
public class User {
    private String name;

    public User() {
        System.out.println("生命周期：1.bean对象创建 调用无参构造器");
    }

    public void setName(String name) {
        System.out.println("生命周期：2.给对象设置属性 依赖注入");
        this.name = name;
    }
    public void initMethod(){
        System.out.println("生命周期：4、初始化");
    }

    public void destroyMethod(){
        System.out.println("生命周期：7、销毁");
    }

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                '}';
    }
}
